import Vue from 'vue';
import Vuex from 'vuex';
import 'viewerjs/dist/viewer.css';
import Viewer from 'v-viewer';

Vue.use(Vuex);
Vue.component('Viewer', Viewer);
Vue.use(Viewer, {
  defaultOptions: {
    zIndex: 9999
  }
});
Viewer.setDefaults({
  Options: {
    inline: false,
    button: true,
    navbar: false,
    title: false,
    toolbar: true,
    tooltip: true,
    movable: true,
    zoomable: true,
    rotatable: true,
    scalable: true,
    transition: true,
    fullscreen: true,
    keyboard: true,
    url: 'data-source'
  }
});
const modulesFiles = require.context('./modules', true, /\.js$/);
const modules = modulesFiles.keys().reduce((module, modulePath) => {
  const moduleName = modulePath.replace(/^\.\/(.*)\.\w+$/, '$1');
  const value = modulesFiles(modulePath);
  module[moduleName] = value.default;
  return module;
}, {});

const Store = new Vuex.Store({
  modules,
  // strict: process.env.DEV,
});
export default Store;
